
package com.cango.framework.base.util;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by BOZ on 2015/10/27.
 */
public class Counter {
    private AtomicInteger atomicInteger = new AtomicInteger();

    private static Counter counter;

    private Counter() {

    }

    public static Counter getInstance() {
        if (counter == null) {
            counter = new Counter();
        }
        return counter;
    }

    public int getCurrent() {
        /*if(atomicInteger.get() == 99999)
            atomicInteger.set(0);*/
        return atomicInteger.incrementAndGet();
    }
}
